#pragma once
struct AVFormatContext;
struct AVCodecParameters;
struct AVInputFormat;
struct AVDictionary;
struct AVPacket;
struct AVRational;
struct AVThreadMessageQueue;

class FDemuxer {
public:
	FDemuxer();
	~FDemuxer();
	int open_demuxer(const char* url, AVInputFormat* fmt=0);
	void set_output_que(AVThreadMessageQueue* planes);
	void close_demuxer();
	int read_packet();
	
	AVCodecParameters* vcpara=0;
	AVCodecParameters* acpara=0;
	AVPacket* pkt=0;
	int videoStream=-1;
	int audioStream=-1;
	AVRational* vs_timebase=0;
	AVRational* v_frame_rate = 0;
	AVRational* as_timebase =0;
	
private:
	AVFormatContext* demx=0;
	AVDictionary* options=0;
	AVThreadMessageQueue* que=0;
	
	int streamsCount=0;
	int duration=0;
};